# 定义了一个学生类：
# 属性:学号，姓名，年龄，性别，身高，体重，成绩，家庭地址，电话号码。
# 行为：学习（要求参数传入学习的时间），
# 玩游戏（要求参数传入游戏名），
# 编程（要求参数传入写代码的行数），
# 数的求和（要求参数用变长参数来做，返回求和结果）

class Student:
    def __init__(self,idcard,name,age,gender,height,weight,grades,address,phone,time,gamename,long):
        self.idcard = idcard
        self.name = name
        self.age = age
        self.gender = gender
        self.height = height
        self.weight = weight
        self.grades = grades
        self.address = address
        self.phone = phone
        self.time = time
        self.gamename = gamename
        self.long = long
        # self.num = num

    def study(self):
        print("{}学习了{}".format(self.name,self.time))

    def play(self):
        print("{}玩了{}".format(self.name,self.gamename))

    def program(self):
        print("{}写了{}行代码".format(self.name,self.long))

    def sum1(self,*num):
        self.num = num
        b = sum(self.num)
        print("数的和为{}".format(b))

student1 = Student(1,'张三',15,'男',50,180,86,'小区','12345678910','3小时','三国志',32)
student1.study()
student1.play()
student1.program()
student1.sum1(1,2,3,4)





# 车类：
# 属性：车型号，车轮数，车身颜色，车重量，油箱存储大小 。
# 功能：跑（要求参数传入车的具体功能，比如越野，赛车）
# 创建：法拉利，宝马，铃木，五菱，拖拉机对象

class Car:
    def __init__(self,brand = "",num = 0,color = "",weight = 0.00,oil = 0.00,function = ""):
        self.brand = brand
        self.num = num
        self.color = color
        self.weight = weight
        self.oil = oil
        self.function = function

    def run(self):
        print("一辆重{}kg,有{}个车轮,油箱为{}升的{}{}{}正在跑".format(self.weight,self.num,self.oil,self.color,self.brand,self.function))

falali = Car("法拉利",4,"红色",2000,20,"跑车")
falali.run()
baoma = Car("宝马",4,"黑色",2000,20,"赛车")
baoma.run()
linmu = Car("铃木",4,"白色",2000,20,"跑车")
linmu.run()
wuling = Car("五菱",4,"黑色",2000,20,"跑车")
wuling.run()
tuolaji = Car("拖拉机",4,"黄色",4000,20,"跑车")
tuolaji.run()



# 笔记本：
# 属性：型号，待机时间，颜色，重量，cpu型号，内存大小，硬盘大小。
# 行为：打游戏（传入游戏的名称）,办公
class Laptop:
    def __init__(self,type = "",stoptime = "",color = "",wight = 0.00,cpu = "",memory = "",harddisk = ""):
        self.type = type
        self.stoptime = stoptime
        self.color = color
        self.weight = wight
        self.cpu = cpu
        self.memory = memory
        self.harddisk = harddisk

    def play(self):
        print("使用型号为{}，待机时间为{}，cpu型号为{}，内存大小为{}，硬盘大小为{}，重{}kg的{}笔记本电脑打游戏".format(self.type,self.stoptime,self.cpu,self.memory,self.harddisk,self.weight,self.color))

    def work(self):
        print("使用型号为{}，待机时间为{}，cpu型号为{}，内存大小为{}，硬盘大小为{}，重{}kg的{}笔记本电脑办公".format(self.type, self.stoptime, self.cpu,self.memory, self.harddisk,self.weight, self.color))


laptop = Laptop("惠普","24小时","黑色","3","i5","4GB","256GB")
laptop.play()

class work(Laptop):
    pass
work1 = work("惠普","24小时","黑色","3","i5","4GB","256GB")
work1.work()


# iv.猴子类：属性：类别，性别，身体颜色，体重。
# 行为：造火（要求传入造火的材料：比如木棍还是石头），
# 学习事物（要求参数传入学习的具体事物，可以不止学习一种事物）
class Monkey:
    category = ""
    sex = ""
    color = ""
    weight = 0.00

    def fire(self, material):
        print(self.category, "类猴子用", material, "造火。")

    def study(self, thing):
        print(self.category, "类猴子在学习", thing)






# 人类：
# 属性:
# 姓名，性别，年龄，所拥有的手机剩余话费，手机品牌，手机电池容量，手机屏幕大小，手机最大待机时长，所拥有的积分。
# 功能：
# 发短信（要求参数传入短信内容）。
# 打电话（要求传入要打的电话号码和要打的时间长度。程序里判断号码是否为空或者本人的话费是否小于1元，
#       若为空或者小于1元则报相对应的错误信息，否则的话拨通。
#       结束后，按照时间长度扣费并返回扣费并且按照分钟给手机卡累加积分
#      （0~10分钟：1元/钟、15个积分/钟，10~20分钟：0.8元/钟、39个积分/钟，其他：0.65元/钟、48个积分/钟））
class Human:
    def __init__(self,name,age,reminder,brand,battery,screen,standby,integral):
        self.name = name
        self.age = age
        self.reminder = reminder
        self.brand = brand
        self.battery = battery
        self.screen = screen
        self.standby = standby
        self.integral = integral

    def texting(self,information):
        print(information)

    def call(self,number,time):
        if self.reminder < 1:
            print("花费不足")
        elif len(number) != 11:
            print("请输入正确的手机号！")
        elif time < 1:
            print("请输入正确的通话时间！")
        elif time > 0 and time <= 10:
            blance = time
            jifen = time*15
            self.reminder -= blance
            self.integral += jifen
        elif time > 10 and time <= 20:
            blance = 10 + (time-10)*0.8
            jifen = 150 + (time-10)*39
            self.reminder = self.reminder - blance
            self.integral = self.integral + jifen
        elif time > 20:
            blance = 18 + (time-20)*0.65
            jifen = 540 + (time-20)*48
            self.reminder = self.reminder - blance
            self.integral = self.integral + jifen
        print("本次花费", blance, "元，还剩", self.reminder, "元话费")
        print("积分增加", jifen, "分，现有积分：", self.integral, "分")


onehuman = Human("张三",25,3,"vivo","5000mA","200*100mm","6h",0)
onehuman.texting("你好，世界")
onehuman.call("17344849894",10)

